
package shining365.programmableweb.data.model;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.builder.JAXBEqualsBuilder;
import org.jvnet.jaxb2_commons.lang.builder.JAXBHashCodeBuilder;
import org.jvnet.jaxb2_commons.lang.builder.JAXBToStringBuilder;


/**
 * <p>Java class for anonymous complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType>
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element ref="{http://shining365.cn/programmableweb/data/mashup}mashup" maxOccurs="unbounded" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "mashup"
})
@XmlRootElement(name = "mashups")
@Entity(name = "shining365.programmableweb.data.model.Mashups")
@Table(name = "MASHUPS")
@Inheritance(strategy = InheritanceType.JOINED)
public class Mashups
    implements Equals, HashCode, ToString
{

    protected List<shining365.programmableweb.data.model.Mashup> mashup;
    @XmlAttribute(name = "Hjid")
    protected Long hjid;

    /**
     * Gets the value of the mashup property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the mashup property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getMashup().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link shining365.programmableweb.data.model.Mashup }
     * 
     * 
     */
    @OneToMany(targetEntity = shining365.programmableweb.data.model.Mashup.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "MASHUP_MASHUPS_ID")
    public List<shining365.programmableweb.data.model.Mashup> getMashup() {
        if (mashup == null) {
            mashup = new ArrayList<shining365.programmableweb.data.model.Mashup>();
        }
        return this.mashup;
    }

    /**
     * 
     * 
     */
    public void setMashup(List<shining365.programmableweb.data.model.Mashup> mashup) {
        this.mashup = mashup;
    }

    @Transient
    public boolean isSetMashup() {
        return ((this.mashup!= null)&&(!this.mashup.isEmpty()));
    }

    public void unsetMashup() {
        this.mashup = null;
    }

    public void equals(Object object, EqualsBuilder equalsBuilder) {
        if (!(object instanceof Mashups)) {
            equalsBuilder.appendSuper(false);
            return ;
        }
        if (this == object) {
            return ;
        }
        final Mashups that = ((Mashups) object);
        equalsBuilder.append(this.getMashup(), that.getMashup());
    }

    public boolean equals(Object object) {
        if (!(object instanceof Mashups)) {
            return false;
        }
        if (this == object) {
            return true;
        }
        final EqualsBuilder equalsBuilder = new JAXBEqualsBuilder();
        equals(object, equalsBuilder);
        return equalsBuilder.isEquals();
    }

    public void hashCode(HashCodeBuilder hashCodeBuilder) {
        hashCodeBuilder.append(this.getMashup());
    }

    public int hashCode() {
        final HashCodeBuilder hashCodeBuilder = new JAXBHashCodeBuilder();
        hashCode(hashCodeBuilder);
        return hashCodeBuilder.toHashCode();
    }

    public void toString(ToStringBuilder toStringBuilder) {
        {
            List<shining365.programmableweb.data.model.Mashup> theMashup;
            theMashup = this.getMashup();
            toStringBuilder.append("mashup", theMashup);
        }
    }

    public String toString() {
        final ToStringBuilder toStringBuilder = new JAXBToStringBuilder(this);
        toString(toStringBuilder);
        return toStringBuilder.toString();
    }

    /**
     * Gets the value of the hjid property.
     * 
     * @return
     *     possible object is
     *     {@link Long }
     *     
     */
    @Id
    @Column(name = "HJID")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getHjid() {
        return hjid;
    }

    /**
     * Sets the value of the hjid property.
     * 
     * @param value
     *     allowed object is
     *     {@link Long }
     *     
     */
    public void setHjid(Long value) {
        this.hjid = value;
    }

}
